package bounce;

/**
 * 
 * Class to represent a gem shape.
 * @author Ken Neth Yeoh
 *
 */

public class GemShape extends Shape {
	
	public GemShape(int x, int y, int deltaX, int deltaY, int width, int height) {
		super(x, y, deltaX, deltaY, width, height);
	}

	@Override
	public void paint(Painter painter) {
		int leftVertice;
		int rightVertice;
		int halfHeight;
		int bottom;
		int right;
		
		halfHeight = fY + (fHeight / 2);
		bottom = fY + fHeight;
		right = fX + fWidth;
		
		if(fWidth < 40) {
			leftVertice = fX + (fWidth / 2);
			rightVertice = fX + (fWidth / 2);
		} else {
			leftVertice = fX + 20;
			rightVertice = fX + fWidth - 20;
		}
		
		painter.drawLine(fX, halfHeight, leftVertice, fY);
		painter.drawLine(leftVertice, fY, rightVertice, fY);
		painter.drawLine(rightVertice, fY, right, halfHeight);
		painter.drawLine(right, halfHeight, rightVertice, bottom);
		painter.drawLine(rightVertice, bottom, leftVertice, bottom);
		painter.drawLine(leftVertice, bottom, fX, halfHeight);
	}
}
